package com.dgut.smart_house.mapper;

import com.dgut.smart_house.domain.User;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;

@Mapper
@Repository
public interface UserMapper {

    @Select("select * from user where user_id=#{userId}")
    public User findByUserId(@Param("userId") String userId);

    @Insert("insert into user (user_id,password,salt,email,perms) values(#{userId},#{password},#{salt},#{email},#{perms})")
    public int createUser(User user);

    @Select("select * from user where id=#{id}")
    public User findById(int id);

}
